<block name="footer">
    <script type="text/javascript" src="__HUI__/lib/jquery/1.9.1/jquery.min.js"></script>
    <!--<script type="text/javascript" src="__HUI__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>-->
    <!--<script type="text/javascript" src="__HUI__/lib/jquery.validation/1.14.0/validate-methods.js"></script>-->
    <!--<script type="text/javascript" src="__HUI__/lib/jquery.validation/1.14.0/messages_zh.js"></script>-->
    <script type="text/javascript" src="__HUI__/static/h-ui/js/H-ui.js"></script>
    <script type="text/javascript" src="__HUI__/static/h-ui.admin/js/H-ui.admin.page.js"></script>
    <script type="text/javascript" src="__HUI__/layui-v2.2.45/layui/layui.all.js"></script>
    <!--<script type="text/javascript" src="__HUI__/laydate/laydate.js"></script>-->
    <script type="text/javascript">
        function exit(){
            layer.confirm('确认要退出吗？',{icon:3},function(){
                window.location.href = "{:U('Home/Login/logout')}";
            })
        }

        function modaldemo(){
            $("#modal-demo").modal("show")
        }
        $("#save").click(function(){
            var oldPassword;
            var newPassword;
            var checkNewPassword;
            $(".old-password-msg1").css("display","none");
            $(".old-password-msg2").css("display","none");
            $(".new-password-msg").css("display","none");
            $(".check-new-password-msg1").css("display","none");
            $(".check-new-password-msg1").css("display","none");

            if ($("#oldPassword input").val()) {
                oldPassword = $("#oldPassword input").val();
            } else{
                $(".old-password-msg1").css("display","block");
                return;
            }

            if ($("#newPassword input").val()) {
                newPassword = $("#newPassword input").val();
            } else{
                $(".new-password-msg").css("display","block");
                return;
            }

            if ($("#checkNewPassword input").val()) {
                checkNewPassword = $("#checkNewPassword input").val();
            } else{
                $(".check-new-password-msg1").css("display","block");
                return;
            }

            if(newPassword != checkNewPassword){
                $(".check-new-password-msg2").css("display","block");
                return;
            }

            $(".old-password-msg1").css("display","none");
            $(".old-password-msg2").css("display","none");
            $(".new-password-msg").css("display","none");
            $(".check-new-password-msg1").css("display","none");
            $(".check-new-password-msg1").css("display","none");
            $.ajax({
                type : "post",
                url:"{:U('Home/Change/change_post')}",
                data:{
                    oldPassword : oldPassword,
                    newPassword : newPassword
                },
                dataType: "json",
                success : function(res){
                    if(res == 0){
                        $("#oldPassword input").val("");
                        $("#newPassword input").val("");
                        $("#checkNewPassword input").val("");
                        $("#modal-demo").modal("hide");
                    }else {
                        $(".old-password-msg2").css("display","block");
                    }
                }
            })
        })
    </script>
</block>
<div style="display: none">

</div>
<block name="script"></block>
